package com.zx.erp.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zx.erp.sys.bean.Users;
import com.zx.erp.sys.mapper.UsersMapper;
import com.zx.erp.sys.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 作者信息
 * @since 2021-11-10
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
    @Autowired
    private UsersMapper usersMapper;

    @Override
    public Users login(String uname, String upassword) {
        return usersMapper.login(uname, upassword);
    }

    @Override
    public Page<Users> findAll(Users users, Integer pageNo, Integer pageSize) {
        // Step1：创建一个 Page 对象
        Page<Users> page = new Page<Users>(pageNo, pageSize);
        // Step2：调用 mybatis-plus 提供的分页查询方法
        Page<Users> pageInfo = usersMapper.findAll(page, users);

        return pageInfo;
    }

}
